const Sequelize = require('sequelize');
const baseModel = require('../baseModel');

class courseModel extends baseModel{
  constructor(){
    super('course',{
      id:{
        type: Sequelize.INTEGER,
        autoIncrement: true,
        allowNull: false,
        primaryKey:true
      },
      order:{
        type: Sequelize.INTEGER,
        allowNull: false,
      },
      org:{
        type: Sequelize.INTEGER,
        allowNull: false,
      },
      chapter:{
        type: Sequelize.INTEGER,
        allowNull: false,
      },
      name:{
        type: Sequelize.STRING(15),
        allowNull: false
      },
      description:{
        type: Sequelize.STRING(50),
        allowNull: false
      },
      type:{
        type: Sequelize.INTEGER,
        allowNull: false
      },
      work_id:{
        type: Sequelize.INTEGER,
        allowNull: false
      },
      updatedAt: {
        type: Sequelize.DATE,
        allowNull: false
      },
      createdAt:{
        type: Sequelize.DATE,
        allowNull: false
      }
    });
    this.model = super.getModel();
    this.model.sync();
  }
}

module.exports = new courseModel();
